#ifndef PCRCHARTMANAGER_H
#define PCRCHARTMANAGER_H

#include <QWidget>
#include "pcrChartItem.h"
#include <QRandomGenerator>

class PCRChartManager : public QWidget
{
    Q_OBJECT
public:
    PCRChartManager(QWidget* parent = nullptr);
    int addChart(QString chartName);
    int addCurve(QString name, QString chartName, const QVector<QPointF> &pointList, QString type="spline");
    int changeChart(QString name);     // Chart切换
    QString getChartName();

    // 状态更新

    void updateStandardLegend();
    void updateThreshold();
    void updateShow();


    void init(PCRState *state);

    QChartView*                 _chartView = nullptr;

signals:
    void sigBaseLineChanged();
public slots:
    void on_pageChanged();
    void on_filterResultChanged();
    void on_boldResultChanged();
    void on_thrChanged();
    void on_modelChanged();
    void on_standardChanged();

private:


    void resizeEvent(QResizeEvent *event) override;
    QVector<QPointF>        createThrCurve(double value);
    QVector<QPointF>        createStandardCurve(double k, double b);

    PCRState*                   pState = nullptr;


    QString                     _chart;

    QMap<QString, PCRChartItem*>       _chartMap;

    QHBoxLayout*                _layout = nullptr;


};

#endif // PCRCHARTMANAGER_H
